<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Queries the status of a service</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.win32-query-service-status" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">win32_query_service_status</h1>
  <p class="verinfo">(PECL win32service &gt;=0.1.0)</p><p class="refpurpose"><span class="refname">win32_query_service_status</span> &mdash; <span class="dc-title">Queries the status of a service</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.win32-query-service-status-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>win32_query_service_status</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$servicename</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$machine</code></span>
  ] ) : <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span></div>


  <p class="para rdfs-comment">
   Queries the current status for a service, returning an array of
   information.
  </p>

 </div>

 <div class="refsect1 parameters" id="refsect1-function.win32-query-service-status-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">servicename</code></dt>

     <dd>

      <p class="para">
       The short name of the service.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">machine</code></dt>

     <dd>

      <p class="para">
       The optional machine name.  If omitted, the local machine will be used.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.win32-query-service-status-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns an array consisting of the following information on success，参数错误时返回 <strong><code>FALSE</code></strong>，或失败时返回一个 <a href="win32service.constants.errors.html" class="link">Win32 错误码</a>。
  </p>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">ServiceType</code></dt>

     <dd>

      <p class="para">
       The dwServiceType. See <a href="win32service.constants.servicetype.html" class="link">Win32Service Service Type Bitmasks</a>.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">CurrentState</code></dt>

     <dd>

      <p class="para">
       The dwCurrentState. See <a href="win32service.constants.servicestatus.html" class="link">Win32Service Service Status Constants</a>.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">ControlsAccepted</code></dt>

     <dd>

      <p class="para">
       Which service controls are accepted by the service. See <a href="win32service.constants.controlsaccepted.html" class="link">Win32Service Service Control Message Accepted Bitmasks</a>.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">Win32ExitCode</code></dt>

     <dd>

      <p class="para">
       If the service exited, the return code from the process. This value is equal to 
       <strong><code>WIN32_ERROR_SERVICE_SPECIFIC_ERROR</code></strong> 
       if the exit mode is not gracefuly. See 
       <a href="win32service.constants.errors.html" class="link">Win32Service error codes</a> and 
       <span class="function"><a href="win32_set_service_exit_mode.html" class="function">win32_set_service_exit_mode()</a></span>
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">ServiceSpecificExitCode</code></dt>

     <dd>

      <p class="para">
       If the service exited with an error condition, the service specific
       code that is logged in the event log is visible here. This value is equal 
       to the value defined by <span class="function"><a href="win32_set_service_exit_code.html" class="function">win32_set_service_exit_code()</a></span>
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">CheckPoint</code></dt>

     <dd>

      <p class="para">
       If the service is shutting down, holds the current check point number.
       This is used by the SCM as a kind of heart-beat to detect a wedged service
       process.  The value of the check point is best interpreted in
       conjunction with the WaitHint value.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">WaitHint</code></dt>

     <dd>

      <p class="para">
       If the service is shutting down it will set WaitHint to a checkpoint
       value that will indicate 100% completion.  This can be used to
       implement a progress indicator.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">ProcessId</code></dt>

     <dd>

      <p class="para">
       The Windows process identifier. If 0, the process is not running.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">ServiceFlags</code></dt>

     <dd>

      <p class="para">
       The dwServiceFlags. See <a href="win32service.constants.serviceflag.html" class="link">Win32Service Service Service Flag Constants</a>.
      </p>
     </dd>

    
   </dl>

  </p>

 </div>


 <div class="refsect1 seealso" id="refsect1-function.win32-query-service-status-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><a href="win32service.constants.html" class="link">Win32Service Predefined Constants</a></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>